\(\int \frac {\tan (x)}{\sqrt {a+a \cot ^2(x)}} \, dx\) [17]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 15, antiderivative size = 36 \[ \int \frac {\tan (x)}{\sqrt {a+a \cot ^2(x)}} \, dx=\frac {\text {arctanh}\left (\frac {\sqrt {a \csc ^2(x)}}{\sqrt {a}}\right )}{\sqrt {a}}-\frac {1}{\sqrt {a \csc ^2(x)}} \]

[Out]

arctanh((a*csc(x)^2)^(1/2)/a^(1/2))/a^(1/2)-1/(a*csc(x)^2)^(1/2)

Rubi [A] (verified)

Time = 0.10 (sec) , antiderivative size = 36, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {3738, 4209, 53, 65, 213} \[ \int \frac {\tan (x)}{\sqrt {a+a \cot ^2(x)}} \, dx=\frac {\text {arctanh}\left (\frac {\sqrt {a \csc ^2(x)}}{\sqrt {a}}\right )}{\sqrt {a}}-\frac {1}{\sqrt {a \csc ^2(x)}} \]

[In]

Int[Tan[x]/Sqrt[a + a*Cot[x]^2],x]

[Out]

ArcTanh[Sqrt[a*Csc[x]^2]/Sqrt[a]]/Sqrt[a] - 1/Sqrt[a*Csc[x]^2]

Rule 53

Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[(a + b*x)^(m + 1)*((c + d*x)^(n + 1
)/((b*c - a*d)*(m + 1))), x] - Dist[d*((m + n + 2)/((b*c - a*d)*(m + 1))), Int[(a + b*x)^(m + 1)*(c + d*x)^n,
x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && LtQ[m, -1] &&  !(LtQ[n, -1] && (EqQ[a, 0] || (NeQ[
c, 0] && LtQ[m - n, 0] && IntegerQ[n]))) && IntLinearQ[a, b, c, d, m, n, x]

Rule 65

Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_), x_Symbol] :> With[{p = Denominator[m]}, Dist[p/b, Sub
st[Int[x^(p*(m + 1) - 1)*(c - a*(d/b) + d*(x^p/b))^n, x], x, (a + b*x)^(1/p)], x]] /; FreeQ[{a, b, c, d}, x] &
& NeQ[b*c - a*d, 0] && LtQ[-1, m, 0] && LeQ[-1, n, 0] && LeQ[Denominator[n], Denominator[m]] && IntLinearQ[a,
b, c, d, m, n, x]

Rule 213

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(-(Rt[-a, 2]*Rt[b, 2])^(-1))*ArcTanh[Rt[b, 2]*(x/Rt[-a, 2])]
, x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (LtQ[a, 0] || GtQ[b, 0])

Rule 3738

Int[(u_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]^2)^(p_), x_Symbol] :> Int[ActivateTrig[u*(a*sec[e + f*x]^2)^p]
, x] /; FreeQ[{a, b, e, f, p}, x] && EqQ[a, b]

Rule 4209

Int[((b_.)*sec[(e_.) + (f_.)*(x_)]^2)^(p_.)*tan[(e_.) + (f_.)*(x_)]^(m_.), x_Symbol] :> Dist[b/(2*f), Subst[In
t[(-1 + x)^((m - 1)/2)*(b*x)^(p - 1), x], x, Sec[e + f*x]^2], x] /; FreeQ[{b, e, f, p}, x] &&  !IntegerQ[p] &&
 IntegerQ[(m - 1)/2]

Rubi steps \begin{align*} \text {integral}& = \int \frac {\tan (x)}{\sqrt {a \csc ^2(x)}} \, dx \\ & = -\left (\frac {1}{2} a \text {Subst}\left (\int \frac {1}{(-1+x) (a x)^{3/2}} \, dx,x,\csc ^2(x)\right )\right ) \\ & = -\frac {1}{\sqrt {a \csc ^2(x)}}-\frac {1}{2} \text {Subst}\left (\int \frac {1}{(-1+x) \sqrt {a x}} \, dx,x,\csc ^2(x)\right ) \\ & = -\frac {1}{\sqrt {a \csc ^2(x)}}-\frac {\text {Subst}\left (\int \frac {1}{-1+\frac {x^2}{a}} \, dx,x,\sqrt {a \csc ^2(x)}\right )}{a} \\ & = \frac {\text {arctanh}\left (\frac {\sqrt {a \csc ^2(x)}}{\sqrt {a}}\right )}{\sqrt {a}}-\frac {1}{\sqrt {a \csc ^2(x)}} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.03 (sec) , antiderivative size = 19, normalized size of antiderivative = 0.53 \[ \int \frac {\tan (x)}{\sqrt {a+a \cot ^2(x)}} \, dx=\frac {-1+\text {arctanh}(\sin (x)) \csc (x)}{\sqrt {a \csc ^2(x)}} \]

[In]

Integrate[Tan[x]/Sqrt[a + a*Cot[x]^2],x]

[Out]

(-1 + ArcTanh[Sin[x]]*Csc[x])/Sqrt[a*Csc[x]^2]

Maple [A] (verified)

Time = 0.42 (sec) , antiderivative size = 39, normalized size of antiderivative = 1.08

method result size
default \(-\frac {\sqrt {4}\, \left (\sin \left (x \right )+\ln \left (-\cot \left (x \right )+\csc \left (x \right )-1\right )-\ln \left (-\cot \left (x \right )+\csc \left (x \right )+1\right )\right ) \csc \left (x \right )}{2 \sqrt {a \csc \left (x \right )^{2}}}\) \(39\)
risch \(-\frac {{\mathrm e}^{2 i x}}{2 \sqrt {-\frac {a \,{\mathrm e}^{2 i x}}{\left ({\mathrm e}^{2 i x}-1\right )^{2}}}\, \left ({\mathrm e}^{2 i x}-1\right )}+\frac {1}{2 \left ({\mathrm e}^{2 i x}-1\right ) \sqrt {-\frac {a \,{\mathrm e}^{2 i x}}{\left ({\mathrm e}^{2 i x}-1\right )^{2}}}}-\frac {i {\mathrm e}^{i x} \ln \left ({\mathrm e}^{i x}-i\right )}{\sqrt {-\frac {a \,{\mathrm e}^{2 i x}}{\left ({\mathrm e}^{2 i x}-1\right )^{2}}}\, \left ({\mathrm e}^{2 i x}-1\right )}+\frac {i {\mathrm e}^{i x} \ln \left ({\mathrm e}^{i x}+i\right )}{\sqrt {-\frac {a \,{\mathrm e}^{2 i x}}{\left ({\mathrm e}^{2 i x}-1\right )^{2}}}\, \left ({\mathrm e}^{2 i x}-1\right )}\) \(157\)

[In]

int(tan(x)/(a+a*cot(x)^2)^(1/2),x,method=_RETURNVERBOSE)

[Out]

-1/2*4^(1/2)*(sin(x)+ln(-cot(x)+csc(x)-1)-ln(-cot(x)+csc(x)+1))/(a*csc(x)^2)^(1/2)*csc(x)

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 78 vs. \(2 (28) = 56\).

Time = 0.28 (sec) , antiderivative size = 78, normalized size of antiderivative = 2.17 \[ \int \frac {\tan (x)}{\sqrt {a+a \cot ^2(x)}} \, dx=\frac {{\left (\tan \left (x\right )^{2} + 1\right )} \sqrt {a} \log \left (2 \, a \tan \left (x\right )^{2} + 2 \, \sqrt {a} \sqrt {\frac {a \tan \left (x\right )^{2} + a}{\tan \left (x\right )^{2}}} \tan \left (x\right )^{2} + a\right ) - 2 \, \sqrt {\frac {a \tan \left (x\right )^{2} + a}{\tan \left (x\right )^{2}}} \tan \left (x\right )^{2}}{2 \, {\left (a \tan \left (x\right )^{2} + a\right )}} \]

[In]

integrate(tan(x)/(a+a*cot(x)^2)^(1/2),x, algorithm="fricas")

[Out]

1/2*((tan(x)^2 + 1)*sqrt(a)*log(2*a*tan(x)^2 + 2*sqrt(a)*sqrt((a*tan(x)^2 + a)/tan(x)^2)*tan(x)^2 + a) - 2*sqr
t((a*tan(x)^2 + a)/tan(x)^2)*tan(x)^2)/(a*tan(x)^2 + a)

Sympy [F]

\[ \int \frac {\tan (x)}{\sqrt {a+a \cot ^2(x)}} \, dx=\int \frac {\tan {\left (x \right )}}{\sqrt {a \left (\cot ^{2}{\left (x \right )} + 1\right )}}\, dx \]

[In]

integrate(tan(x)/(a+a*cot(x)**2)**(1/2),x)

[Out]

Integral(tan(x)/sqrt(a*(cot(x)**2 + 1)), x)

Maxima [A] (verification not implemented)

none

Time = 0.35 (sec) , antiderivative size = 52, normalized size of antiderivative = 1.44 \[ \int \frac {\tan (x)}{\sqrt {a+a \cot ^2(x)}} \, dx=-\frac {1}{2} \, a {\left (\frac {\log \left (-\frac {\sqrt {a} - \sqrt {\frac {a}{\sin \left (x\right )^{2}}}}{\sqrt {a} + \sqrt {\frac {a}{\sin \left (x\right )^{2}}}}\right )}{a^{\frac {3}{2}}} + \frac {2}{a \sqrt {\frac {a}{\sin \left (x\right )^{2}}}}\right )} \]

[In]

integrate(tan(x)/(a+a*cot(x)^2)^(1/2),x, algorithm="maxima")

[Out]

-1/2*a*(log(-(sqrt(a) - sqrt(a/sin(x)^2))/(sqrt(a) + sqrt(a/sin(x)^2)))/a^(3/2) + 2/(a*sqrt(a/sin(x)^2)))

Giac [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 12, normalized size of antiderivative = 0.33 \[ \int \frac {\tan (x)}{\sqrt {a+a \cot ^2(x)}} \, dx=-\frac {\sin \left (x\right )}{\sqrt {a} \mathrm {sgn}\left (\sin \left (x\right )\right )} \]

[In]

integrate(tan(x)/(a+a*cot(x)^2)^(1/2),x, algorithm="giac")

[Out]

-sin(x)/(sqrt(a)*sgn(sin(x)))

Mupad [B] (verification not implemented)

Time = 13.19 (sec) , antiderivative size = 20, normalized size of antiderivative = 0.56 \[ \int \frac {\tan (x)}{\sqrt {a+a \cot ^2(x)}} \, dx=\frac {\mathrm {atanh}\left (\sqrt {\frac {1}{{\sin \left (x\right )}^2}}\right )-\sqrt {{\sin \left (x\right )}^2}}{\sqrt {a}} \]

[In]

int(tan(x)/(a + a*cot(x)^2)^(1/2),x)

[Out]

(atanh((1/sin(x)^2)^(1/2)) - (sin(x)^2)^(1/2))/a^(1/2)